import React from 'react';
import Title from './title';
import {useHistory} from 'react-router';
import Lazyload from 'react-lazyload'; 
import style from './Brand.module.scss';
interface Iprops {
    brandList: Array<object>,
}
const Brand:React.FC<Iprops> = props=>{
    const history = useHistory();
    return <div className={style.brand}>
        <Title title="品牌制造商直供" background="#fff"/>
        <div className={style.wrap}>
            {
                props.brandList.map((item:any)=>{
                    return <div className={style.item} key={item.id}
                    onClick={()=>history.push(`/brandDetail/${item.id}`)}
                    >
                        <Lazyload>
                            <img src={item.new_pic_url} alt=""/>
                        </Lazyload>
                        <div>
                            <h3>{item.name}</h3>
                            <p>{item.floor_price}元起</p>
                        </div>
                    </div>
                })
            }
        </div>
    </div>
}

export default Brand